﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
namespace WebApplication1
{
    public partial class SiteSach : System.Web.UI.MasterPage
    {
        sv_QuanLyNhaSach.AdapterClient service = new sv_QuanLyNhaSach.AdapterClient();

        protected void Page_Load(object sender, EventArgs e)
        {
            Load_LoaiSach();
        }
        private void Load_LoaiSach()
        {
            DataSet ds = new DataSet();
            ds.ReadXml(new StringReader(service.selectqueryByText("select * from dausach")));
            if (ds.Tables.Count > 0)
            {
                if (!IsPostBack)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (ds.Tables[0].Rows[i]["tendausach"].ToString().Trim() != "Tìm theo tên")
                        {
                            if (i == 0)
                                Label1.Text += "<li><a href=SachTimKiemTheoDanhMuc.aspx?ds=" + ds.Tables[0].Rows[i]["kihieu"].ToString().Trim() + ">" + ds.Tables[0].Rows[i]["tendausach"] + "</a></li>";
                            else if (i == ds.Tables[0].Rows.Count - 1)
                                Label1.Text += "<li><a href=SachTimKiemTheoDanhMuc.aspx?ds=" + ds.Tables[0].Rows[i]["kihieu"].ToString().Trim() + ">" + ds.Tables[0].Rows[i]["tendausach"] + "</a></li>";
                            else
                                Label1.Text += "<li><a href=SachTimKiemTheoDanhMuc.aspx?ds=" + ds.Tables[0].Rows[i]["kihieu"].ToString().Trim() + ">" + ds.Tables[0].Rows[i]["tendausach"] + "</a></li>";
                        }
                    }
                }
            }
        }
    }
}